package com.ktwlrj.core.feign;

import com.alibaba.fastjson.JSONArray;
import com.ktwlrj.core.base.ActionResult;
import com.ktwlrj.core.feign.args.ThirdCheckMemberSafeArgs;
import com.ktwlrj.core.feign.dto.MemberDto;
import com.ktwlrj.core.feign.dto.MemberInfoDto;
import com.ktwlrj.core.feign.dto.OrganizationDto;
import com.ktwlrj.core.feign.dto.ThirdCheckSafeDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 会员中心透传接口
 *
 * @author zhouxuanhong
 * @date 2019-05-20 10:14
 * @since JDK1.8
 */
@FeignClient(value = "member-center", fallbackFactory = FeignFallback.class)
public interface McClient {
    /**
     * 通过token获取用户信息
     *
     * @return ActionResult ${@link ActionResult}
     * @author zhouxuanhong
     * @date 2019-05-20 10:16
     */
    @RequestMapping(value = "/mc/member/user/token?headerStrategy=mcSetToken", method = RequestMethod.GET)
    ActionResult<MemberInfoDto> getUserByToken();


    /**
     * 验证用户密码
     *
     * @param args ${@link ThirdCheckMemberSafeArgs}
     * @return ActionResult<ThirdCheckSafeDto> ${@link ActionResult<ThirdCheckSafeDto>}
     * @author zhouxuanhong
     * @date 2019-07-19 16:44
     */
    @RequestMapping(value = "/mc/third/check/member_safe?headerStrategy=mcSetToken", method = RequestMethod.POST)
    ActionResult<ThirdCheckSafeDto> getCheckMemberSafe(ThirdCheckMemberSafeArgs args);


    /**
     * 获取当前机构下的所有会员信息
     *
     * @param orgId    ${@link String}
     * @param realName ${@link String}
     * @param phone    ${@link String}
     * @param type     ${@link Integer} 类型:0-当前机构下,1-全库(此时真实姓名必传)
     * @return List<MemberDto> ${@link List <MemberDto>}
     * @author zhouxuanhong
     * @date 2019-09-12 17:36
     */
    @GetMapping(value = "/mc/member/select/member-list/by-org-id?headerStrategy=mcSetToken")
    ActionResult<Object> getListMemberByOrgId(@RequestParam("orgId") String orgId,
                                                       @RequestParam("type") Integer type,
                                                       @RequestParam("realName") String realName,
                                                       @RequestParam("mobilePhone") String phone);


    /**
     * 获取当前机构下的所有会员信息
     *
     * @param orgId      ${@link String}
     * @param idCard     ${@link String}
     * @param idCardType ${@link String}
     * @param type       ${@link Integer} 类型:0-当前机构下,1-全库(此时真实姓名必传)
     * @return List<MemberDto> ${@link List<MemberDto>}
     * @author zhouxuanhong
     * @date 2019-09-12 17:36
     */
    @GetMapping(value = "/mc/member/select/member-list/by-org-idcard?headerStrategy=mcSetToken")
    ActionResult<List<MemberDto>> getListMemberByOrgIdOrIdCard(@RequestParam("orgId") String orgId,
                                                               @RequestParam("type") Integer type,
                                                               @RequestParam("idCard") String idCard,
                                                               @RequestParam("idCardType") String idCardType);


    /**
     * 通过企业社会信用代码查询企业信息
     *
     * @param socialCreditCode ${@link String}
     * @return List<MemberDto> ${@link List<MemberDto>}
     * @author zhouxuanhong
     * @date 2019-09-12 17:36
     */
    @GetMapping(value = "/mc/member/select/member-info/by-social-Code?headerStrategy=mcSetToken")
    ActionResult<List<MemberDto>> getOrgInfoBySocialCreditCode(@RequestParam("socialCreditCode") String socialCreditCode);


    /**
     * 根据企业账号查询企业会员信息
     *
     * @param account ${@link String}
     * @return MemberDto ${@link MemberDto}
     * @author zhouxuanhong
     * @date 2019-09-25 15:28
     */
    @GetMapping(value = "/mc/member/select/org-user/by-account?headerStrategy=mcSetToken")
    ActionResult<MemberDto> getOrgMemberInfo(@RequestParam("account") String account);


    /**
     * 获取用户当前加入的机构列表
     *
     * @return ActionResult<JSONArray> ${@link  ActionResult< JSONArray >}
     * @author zhouxuanhong
     * @date 2019-09-12 17:36
     */
    @GetMapping(value = "/mc/select/member-org/list?headerStrategy=mcSetToken")
    ActionResult<JSONArray> getMemberOrgSelectList();


    /**
     * 查询企业信息
     *
     * @param orgName ${@link String}
     * @return ActionResult<OrganizationDto> ${@link ActionResult<OrganizationDto>}
     * @author zhou
     * @date 2019-12-06 16:40
     */
    @GetMapping(value = "/mc/org/select/org-info/by-name?headerStrategy=mcSetToken")
    ActionResult<OrganizationDto> queryOrgInfo(@RequestParam("orgName") String orgName);


    /**
     * 获取图片验证码
     *
     * @return ActionResult<Object> ${@link ActionResult<Object>}
     * @author zhou
     * @date 2019-12-09 10:41
     */
    @GetMapping(value = "/mc/select/picture-code?headerStrategy=mcSetToken")
    ActionResult<Object> getPictureCode();


    /**
     * 通过图片验证码获取短信验证码
     *
     * @param mobilePhone  ${@link String}
     * @param code         ${@link String}
     * @param codeId       ${@link String}
     * @param checkAccount ${@link Integer}
     * @return Object ${@link Object} 账号查询结果状态提示要求:1-账号存在时需要提示，2-账号不存在时需要提示
     * @author zhou
     * @date 2019-12-09 10:49
     */
    @GetMapping(value = "/mc/member/select/sms-code/by-picture-code?headerStrategy=mcSetToken")
    Object getSmsCodeAndCheckPictureCode(@RequestParam("mobilePhone") String mobilePhone,
                                         @RequestParam("code") String code,
                                         @RequestParam("codeId") String codeId,
                                         @RequestParam("checkAccount") Integer checkAccount);
}
